/*
 * MyEeprom.c
 *
 * Created: 12/5/2012 6:54:10 PM
 *  Author: Hp-Minion
 */ 
/*****************************************************************************************/
#include <avr/io.h>
#include "General.h"
/*****************************************************************************************/
void EEPROM_write(unsigned int uiAddress, unsigned int ucData)
{
	/* Wait for completion of previous write */
	while(EECR & (1<<EEPE))
	 ;
	/* Set up address and Data Registers */
	EEAR = uiAddress;
	EEDR = ucData;
	/* Write logical one to EEMPE */
	EECR |= (1<<EEMPE);
	/* Start eeprom write by setting EEPE */
	EECR |= (1<<EEPE);
	

}
/*****************************************************************************************/
unsigned int EEPROM_read(unsigned int uiAddress)
{
	/* Wait for completion of previous write */
	while(EECR & (1<<EEPE))
	 ;
	/* Set up address register */
	EEAR = uiAddress;
	/* Start eeprom read by writing EERE */
	EECR |= (1<<EERE);
	/* Return data from Data Register */
	return EEDR;

}
/*****************************************************************************************/